;:sys9*4096
	;.opt p,oo
;
; codieren eines strings
;
	*= $c000
;
fremevl	= $ad9e
frestr	= $b6a3
chkkom	= $aefd
errout	= $a445
strptr	= 34

	          jmp code

	          jmp decode
temp	      .byt 0
lengh	     .byt 0
strget	    jsr chkkom

	          jsr fremevl

	          jsr frestr

	          cmp #0

	          beq short

	          rts
short	     lda #<err

	          sta strptr

	          lda #>err

	          jmp errout
err	       .byte "missing strinG"
;
;
;
code	      jsr strget

	          sta lengh
;
; codierung 1
;

	          ldy #0
sub255	    lda (strptr),y

	          sta temp

	          lda #255

	          sec

	          sbc temp

	          sta (strptr),y

	          iny

	          cpy lengh

	          bne sub255
;
; codierung 2
;

	          ldy #0
adclp	     sty temp

	          lda (strptr),y

	          clc

	          adc temp

	          sta (strptr),y

	          iny

	          cpy lengh

	          bne adclp
;
; codierung 3
;

	          dec lengh

	          ldy lengh
swap	      lda (strptr),y

	          sta latch,y

	          dey

	          cpy #255

	          bne swap
;

	          ldy #0

	          ldx lengh
swap2	     lda latch,x

	          sta (strptr),y

	          iny

	          dex

	          cpx#255

	          bne swap2

	          rts
;
;
;
decode	    jsr strget

	          sta lengh
;
; decode 3
;

	          dec lengh
;

	          ldy lengh
deswap	    lda (strptr),y

	          sta latch,y

	          dey

	          cpy #255

	          bne deswap
;

	          ldy #0

	          ldx lengh
deswap2	   lda latch,x

	          sta (strptr),y

	          iny

	          dex

	          cpx #255

	          bne deswap2
;

	          inc lengh
;
; decode 2
;

	          ldy #0
sublp	     sty temp

	          lda (strptr),y

	          sec

	          sbc temp

	          sta (strptr),y

	          iny

	          cpy lengh

	          bne sublp
;
; decode 1
;

	          ldy #0
dsb255	    lda (strptr),y

	          sta temp

	          lda #255

	          sec

	          sbc temp

	          sta (strptr),y

	          iny

	          cpy lengh

	          bne dsb255

	          rts
;
latch	     .byt 0
